// 例子31

{
    const target = {a: 1, b: 1};
    const source1 = {b: 2, c: 2};
    const source2 = {c: 3, d: 4};

    Object.assign(target, source1, source2);
    console.log(target); // {a: 1, b: 2, c: 3, d: 4}
}

console.log('----------------------------------');

{
    const target = {}
    const source = {
        a: 1,
        b: 'b',
        c() {
            console.log('c');
        }
    }
    Object.defineProperty(source, 'a', {
        enumerable: false
    })
    Object.assign(target, source);
    console.log(target); //  {b: "b", c: ƒ}
}